<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>表格範例</title>
<script type="text/javascript">
	//------------------------------------------------------------------------
	var request_f4 = new createAJAX_f4();

	if (request_f4 == null)
	  alert("無法產生 request 物件:您不能正常使用本網頁");
	
	//依據不同的瀏覽器，取得 XMLHttpRequest 物件
	function createAJAX_f4() {
		try{
			var request_f4 = new XMLHttpRequest();
			return request_f4;
		} catch (erri){
			try{
		        var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
		                             "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
		                             "Microsoft.XMLHTTP"];
		        for (var i=0; i < arrSignatures.length; i++) {
		            try {
		                var request_f4 = new ActiveXObject(arrSignatures[i]);
						return request_f4;
		            } catch (oError) {
		                //ignore
		            }
		        }          
			} catch (errii){
		                //ignore
			}
		}
	}
	
	function safe_tags_f4(str) {
	    return "以下為ajax傳回的 HTML 原始碼<p>"+str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') ;
	}

	function changeDIV_f4() {
		if (request_f4.readyState == 4) {
			if (request_f4.status == 200 ||request_f4.status == 0) {
				var reqTxt = request_f4.responseText;
				var source = safe_tags_f4(reqTxt);
				document.getElementById("f4").innerHTML = reqTxt + source;
			} else
				alert("f4 Error! Request status is " + request_f4.status);
		}
	}

	function startRunAJAX_f4() {
		request_f4 = new createAJAX_f4();
		request_f4.onreadystatechange = changeDIV_f4;
		request_f4.open("post", "control_f4.jsp", true);
		request_f4.setRequestHeader("Content-Type",
				"application/x-www-form-urlencoded");
		sendAllFormField_f4();
	}

	function sendAllFormField_f4() {
		var sParams = "";
		
		for (i = 0; i < document.form_f4.length; i++) {
			var fName = document.form_f4[i].name;
			var fValue = document.form_f4[i].value;
			if(document.form_f4[i].type == "checkbox"){
				if(document.form_f4[i].checked){
					sParams = addPostParam_f4(sParams, fName, fValue);
				}
			}else if(document.form_f4[i].type == "radio"){
				if(document.form_f4[i].checked){
					sParams = addPostParam_f4(sParams, fName, fValue);
				}
			}else if(document.form_f4[i].type == "image"){
				sParams = addPostParam_f4(sParams, fName, fValue);
			}else{
				sParams = addPostParam_f4(sParams, fName, fValue);
			}
		}
		request_f4.send(sParams);
		return sParams;
	}

	function addPostParam_f4(sParams, sParamName, sParamValue) {
		if (sParams.length > 0) {
			sParams += "&";
		}
		return sParams + encodeURIComponent(sParamName) + "="
				+ encodeURIComponent(sParamValue);
	}

	function topagex_f4(topageNum) {
		document.form_f4.toPage.value = topageNum;
		document.form_f4.nextPage.value = "";
		document.form_f4.pk.value = "";
		document.form_f4.command.value = "";
		startRunAJAX_f4();
	}

	function nextPagex_f4(nextPagex) {
		document.form_f4.nextPage.value = nextPagex;
		document.form_f4.toPage.value = "";
		document.form_f4.pk.value = "";
		document.form_f4.command.value = "";
		startRunAJAX_f4();
	}

	function jsort_f4(fName) {
		document.form_f4.sortName.value = fName;
		document.form_f4.toPage.value = 1;
		document.form_f4.pk.value = "";
		document.form_f4.command.value = "";
		startRunAJAX_f4();
	}
	//----------------------
	function jedit_f4(pk) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = "edit";
		startRunAJAX_f4();
	}

	function jdel_f4(pk) {
		var check = confirm("Do you want to delete data ?");
		if (check) {
			document.form_f4.pk.value = pk;
			document.form_f4.command.value = "del";
			startRunAJAX_f4();
		}
	}

	function jyes_f4(pk) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = "yes";
		startRunAJAX_f4();
	}

	function jno_f4(pk) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = "no";
		startRunAJAX_f4();
	}

	function jotherCommand_f4(pk, commandValue) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = commandValue;
		startRunAJAX_f4();
	}
	//************************************
</script>

<style type="text/css">
<!--
.myMOUSE_f4 {
	cursor: pointer;
	color: #00C;
}

.myMOUSE2_f4 {
	cursor: pointer;
	color: #FFF;
	font-weight: bolder;
}

.headerTEXT_f4 {
	color: #FFF;
	font-weight: bolder;
}

.redNumber_f4 {
	color: #F00;
	font-weight: bolder;
	
}
.fontstyle_f4 {
	font-style:;
	font-weight:;
}
-->
</style>

</head>

<body>
	<br>
	<div id="f4">
		<jsp:include page="control_f4.jsp">
			<jsp:param name="jheader"  		value="學生id,姓名,電話" />
			<jsp:param name="pageSize" 		value="3" />
			<jsp:param name="nowPage"  		value="1" />
			<jsp:param name="toPage"   		value="1" />
			<jsp:param name="number" 		value="on"/>
			<jsp:param name="sortStatus"    value="no,no,no"/>
			<jsp:param name="colSize"       value="3"/>
			<jsp:param name="divId"         value="f4"/>
			<jsp:param name="myQuery"         value="自訂查詢條件"/>
		</jsp:include>
	</div>

</body>
</html>
